(function () {
    //3实例化
    let myChart = echarts.init(document.querySelector(".box-left2"));
    let option = {
      title: {
          text: '受欢迎程度', 
          top: 20,
          textStyle: {
            color: "#faff72",
          }, 
        },
      xAxis: {
        show: false,
      },
      //grid 组件离容器的距离。
      grid: {
        left: "3%",
        right: "4%",
        bottom: "-10%",
        containLabel: true,
      },
      yAxis: {
        type: "category",
        data: [
          "风象",
          "水象",
          "土象",
          "火象",
          
        ],
        //坐标轴刻度
        axisTick: {
          show: false,
        },
        //坐标轴 轴线
        axisLine: {
          show: false,
        },
  
        //坐标轴刻度标签相关设置
        axisLabel: {
          show: true,
          textStyle: {
            //改变刻度字体样式
            color: "#9a9fb4",
            fontSize: 15,
          },
        },
      },
  
      series: [
        {
          data: [10, 30, 50, 40,],
          type: "bar",
          showBackground: true,
          //柱状图颜色
          color: "#6abaf2",
          backgroundStyle: {
            color: "#1e2a6a",
          },
          //图上字体一些样式
          itemStyle: {
            normal: {
              label: {
                //字体
                formatter: "{c}%",
                show: true,
                position: "inside",
                textStyle: {
                  fontWeight: "bolder",
                  fontSize: "12",
                  color: "white",
                },
              },
            },
          },
        },
      ],
    };
    myChart.setOption(option);
    //自适应
    window.addEventListener('resize',()=>{
      myChart.resize()
  
    })
  
  })();
  